<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="/jqueryeasyui/jquery.easyui.jsp"%>
<script type="text/javascript">
	$(function() {
		$("#tree").tree({
			"onClick" : processMenu
		});
		$("#tabs").tabs({
			"fit" : true
		});
		addTab("欢迎使用JQuery EasyUI", "点击左边的功能树完成功能！");
	});

	function processMenu(node) {
		if (node.id == "menu") {
			alert("程序错误！")
		}<#list nameInfos as info>
		else if (node.id == "memu_${info.entityName}") {
			addTabByUrl("${info.entityName}管理", "${info.jspName}");
		}</#list>
	}
	
	function addTab(title, content) {
		$("#tabs").tabs("add", {
			"title" : title,
			"content" : content,
			"closable" : true
		});
	}
	
	function addTabByUrl(title, url) {
		$("#tabs").tabs("add", {
			"title" : title,
			"content" : getUrlIframe(url),
			"closable" : true
		});
	}
	
	function getUrlIframe(url) {
		if (url.indexOf("?") == -1) {
			url = url + "?ts=" + new Date().getTime();
		} else {
			url += "&ts=" + new Date().getTime();
		}
		return "<iframe frameborder=\"0\" scrolling=\"yes\" style=\"width: 100%; height: 100%;\" src=\""
				+ url + "\"></iframe>";
	}
</script>
</head>
<body class="easyui-layout">
	<div data-options="region:'west',title:'左边树形菜单'" style="width: 200px;">
		<ul id="tree">
			<li>
				<span>功能选择</span>
				<ul>
					<#list nameInfos as info>
					<li id="memu_${info.entityName}"><span>${info.entityName}管理</span></li>
					</#list>
				</ul>
			</li>
		</ul>
	</div>
	<div data-options="region:'center',title:'主要功能区'">
		<div id="tabs" style="height: 100%;"></div>
	</div>
</body>
</html>